package cn.com.xjnt.vas.ordering.domain.entity;

import java.math.BigDecimal;
import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQuery;
import javax.persistence.PrePersist;
import javax.persistence.PreUpdate;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

import cn.com.xjnt.vas.manage.domain.entity.Organization;

/**
 * The persistent class for the ordering_food_menu database table.
 * 
 */
@Entity
@Table(name = "ordering_food_menu")
@NamedQuery(name = "FoodMenu.findAll", query = "SELECT f FROM FoodMenu f")
public class FoodMenu extends com.frameworks.core.entity.IdEntity {
    private static final long serialVersionUID = 1L;

    private String name;
    private BigDecimal price;
    private BigDecimal discount;
    private String ingredients;
    private int type;

    @Column(name = "is_recommend")
    private int isRecommend;
    private int priority;
    private int count;
    @Temporal(TemporalType.TIMESTAMP)
    private Date createTime;

    @Temporal(TemporalType.TIMESTAMP)
    private Date updateTime;

    @Column(name="bg_name")
    private String bgName;

    @Column(name="bg_img")
    private String bgImg;
    
    @Column(name="bg_url")
    private String bgUrl;
    
    @Column(name="focus_img")
    private String focusImg;

    @Column(name="focus_name")
    private String focusName;

    @Column(name="focus_url")
    private String focusUrl;
    
    @Column(name="corner_img")
    private String cornerImg;

    @Column(name="corner_name")
    private String cornerName;

    @Column(name="corner_url")
    private String cornerUrl;
    
    // bi-directional many-to-one association to FoodSeller
    @ManyToOne
    @JoinColumn(name = "seller_id")
    private FoodSeller foodSeller;

    // bi-directional many-to-one association to FoodSeller
    @ManyToOne
    @JoinColumn(name = "organization_id")
    private Organization organization;
    
    public FoodMenu() {
    }

    public Date getCreateTime() {
        return this.createTime;
    }

    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }

    public BigDecimal getDiscount() {
        return discount;
    }

    public void setDiscount(BigDecimal discount) {
        this.discount = discount;
    }

    public String getIngredients() {
        return this.ingredients;
    }

    public void setIngredients(String ingredients) {
        this.ingredients = ingredients;
    }

    public String getName() {
        return this.name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public BigDecimal getPrice() {
        return this.price;
    }

    public void setPrice(BigDecimal price) {
        this.price = price;
    }

    public int getType() {
        return this.type;
    }

    public void setType(int type) {
        this.type = type;
    }

    public Date getUpdateTime() {
        return this.updateTime;
    }

    public void setUpdateTime(Date updateTime) {
        this.updateTime = updateTime;
    }

    public FoodSeller getFoodSeller() {
        return this.foodSeller;
    }

    public void setFoodSeller(FoodSeller foodSeller) {
        this.foodSeller = foodSeller;
    }

    public Organization getOrganization() {
        return organization;
    }

    public void setOrganization(Organization organization) {
        this.organization = organization;
    }

    public int getIsRecommend() {
        return isRecommend;
    }

    public void setIsRecommend(int isRecommend) {
        this.isRecommend = isRecommend;
    }

    public int getPriority() {
        return priority;
    }

    public void setPriority(int priority) {
        this.priority = priority;
    }

    public int getCount() {
        return count;
    }

    public void setCount(int count) {
        this.count = count;
    }

    public String getBgName() {
        return bgName;
    }

    public void setBgName(String bgName) {
        this.bgName = bgName;
    }

    public String getBgImg() {
        return bgImg;
    }

    public void setBgImg(String bgImg) {
        this.bgImg = bgImg;
    }

    public String getBgUrl() {
        return bgUrl;
    }

    public void setBgUrl(String bgUrl) {
        this.bgUrl = bgUrl;
    }

    public String getFocusImg() {
        return focusImg;
    }

    public void setFocusImg(String focusImg) {
        this.focusImg = focusImg;
    }

    public String getFocusName() {
        return focusName;
    }

    public void setFocusName(String focusName) {
        this.focusName = focusName;
    }

    public String getFocusUrl() {
        return focusUrl;
    }

    public void setFocusUrl(String focusUrl) {
        this.focusUrl = focusUrl;
    }

    public String getCornerImg() {
        return cornerImg;
    }

    public void setCornerImg(String cornerImg) {
        this.cornerImg = cornerImg;
    }

    public String getCornerName() {
        return cornerName;
    }

    public void setCornerName(String cornerName) {
        this.cornerName = cornerName;
    }

    public String getCornerUrl() {
        return cornerUrl;
    }

    public void setCornerUrl(String cornerUrl) {
        this.cornerUrl = cornerUrl;
    }

    @PrePersist
    public void onCreate() {
        this.createTime = this.updateTime = new Date();
    }

    @PreUpdate
    public void onUpdate() {
        this.updateTime = new Date();
    }
}